//@author A0106044W
package commandInfo;

import java.util.EmptyStackException;
import java.util.Stack;

/**
 * 
 * 
 * 	       Sothearith Sreang
 *         All of the CommandInfo part is written by me.
 *         commandInfo is created for command history purposes.
 * 			
 */

public class CommandHistory {

	private Stack<CommandInfo> commandStack;
	
	public CommandHistory() { 
		commandStack = new Stack<CommandInfo>();
	}
	
	public boolean isEmpty() {
		return commandStack.empty();
	}
	
	public int getSize () {
		return commandStack.size();
	}
	
	public CommandInfo getLatestUserCommand() throws EmptyStackException {
		return commandStack.peek();
	}
	
	public CommandInfo popUserCommand() throws EmptyStackException {
		return commandStack.pop();
	}
	
	public void pushUserCommand (CommandInfo userCommand) throws EmptyStackException {
		commandStack.push(userCommand);
	}
	
	public void clearHistory() throws EmptyStackException {
		commandStack.clear();
	}

	
}
